﻿/**
 * ...
 * @author aboutwhat
 */

package bloom.lang;

private typedef TComp<T>  = {
    
    public function compare (a : T) : Int;
}

class Comparator 
{
    
    public static inline function greaterEq <T>(a : TComp<T>, b : T) 
    {
        
        return !less(a,b);
    }
    
    public static inline function greater <T>(a : TComp<T>, b : T) 
    {
        return !lessEq(a,b);
    }
    
    public static inline function eq <T>(a : TComp<T>, b : T) 
    {
        return a.compare(b) == 0;
    }
    
    public static inline function lessEq <T>(a : TComp<T>, b : T) 
    {
        return a.compare(b) <= 0;
    }
    
    public static inline function less <T>(a : TComp<T>, b : T) 
    {
        return a.compare(b) < 0;
    }
   
    
}